#!/bin/bash

mysqlconf=/etc/my.cnf
#mysqlconf=my.cnf

function log() {
    echo -e "$*"
}

[ -f $mysqlconf ] || {
    log "$mysqlconf not exist"
    exit 2
}

sed "/skip-networking/c #skip-networking" -i $mysqlconf
sed "/bind-address/c bind-address                    = 0.0.0.0" -i $mysqlconf

accesssql=rootaccess.sql

[ -f $accesssql ] && {
    mysql -uroot -pAdmin789456 < $accesssql
}

log "OK. now restart mysqld in poky, you can use /etc/init.d/mysqld restart"
exit 0

